package com.keggview.application;

import org.eclipse.jface.action.ICoolBarManager;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.ToolBarContributionItem;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.swt.SWT;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;
import org.eclipse.ui.contexts.IContextService;

public class ApplicationActionBarAdvisor extends ActionBarAdvisor {

	IWorkbenchAction exitAction;
	IWorkbenchAction helpAction;
	IWorkbenchAction searchHelpAction;
	IWorkbenchAction dynamicHelpAction;
	
	static ICoolBarManager cool;
	private static IToolBarManager toolbarPlatform;   
//	private static IToolBarManager toolbarSecond;    
//	private static IToolBarManager toolbarFirst;
	
	public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
		super(configurer);
	}

	@Override
	protected void makeActions(IWorkbenchWindow window) {
    	IContextService service = (IContextService) PlatformUI.getWorkbench().getService(IContextService.class);
		service.activateContext("com.keggview.application.context");
    	exitAction = ActionFactory.QUIT.create(window);
		register(exitAction);
		helpAction = ActionFactory.HELP_CONTENTS.create(window);
		register(helpAction);
		searchHelpAction = ActionFactory.HELP_SEARCH.create(window);
		register(searchHelpAction);
		dynamicHelpAction = ActionFactory.DYNAMIC_HELP.create(window);
		register(dynamicHelpAction);
	}

	@Override
	protected void fillMenuBar(IMenuManager menuBar) {

	}
	
    @Override
	protected void fillCoolBar(ICoolBarManager coolBar) {
    	toolbarPlatform = new ToolBarManager(SWT.FLAT | SWT.LEFT);       
        
    	coolBar.add(new ToolBarContributionItem(toolbarPlatform, "main.basicToolbar"));        
        cool = coolBar;
    }

}
